package com.cloud.pole.shop.biz.goods;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ace.cache.annotation.Cache;
import com.ace.cache.annotation.CacheClear;
import com.cloud.pole.common.biz.BaseBiz;
import com.cloud.pole.mapper.goods.ShopGoodsImgMapper;
import com.cloud.pole.shop.model.entity.goods.ShopGoodsImg;
import com.cloud.pole.shop.model.entity.goods.ShopGoodsValue;

import tk.mybatis.mapper.entity.Example;

/**
 * ${DESCRIPTION}
 *
 * @author wanghaobin
 * @create 2017-06-08 16:23
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class ShopGoodsImgBiz extends BaseBiz<ShopGoodsImgMapper, ShopGoodsImg> {
	
	@Autowired
	ShopGoodsImgMapper shopGoodsImgMapper;
	
	@Cache(key="shopGoodsImgList{1}")
    public List<ShopGoodsImg> selectListByGoodsId(Integer goodsId) {
		 Example example = new Example(ShopGoodsValue.class);
         //example.setOrderByClause("order_level");
 	     example.createCriteria().andEqualTo("goodsId", goodsId);
		 return selectByExample(example);
    }

	@CacheClear(key= "shopGoodsImgList{1}")
	public void deleteByGoodsId(Integer goodsId) {
		shopGoodsImgMapper.deleteByGoodsId(goodsId);
	}
	
}
